package br.com.atomware.sgtp.client.managed.ui;

import com.google.gwt.requestfactory.ui.client.ProxyRenderer;

import br.com.atomware.sgtp.client.managed.request.EmpresaProxy;

/**
 * Renders {@link EmpresaProxy for display to the user. Requires the
 *  properties to have been fetched.
 */
public class EmpresaProxyRenderer extends ProxyRenderer<EmpresaProxy> {
  private static EmpresaProxyRenderer INSTANCE;

  public static EmpresaProxyRenderer instance() {
    if (INSTANCE == null) {
      INSTANCE = new EmpresaProxyRenderer();
    }

    return INSTANCE;
  }

  protected EmpresaProxyRenderer() {
    super(new String[] {"nome"});
  }

  public String render(EmpresaProxy object) {
    if (object == null) {
      return "";
    }
    return object.getNome() + " (" + object.getId() + ")";
  }
}
